#ifndef CClient_H
#define CClient_H
/********************************************************************************
** @ Date:2025/05/19
** @ Author: HanJiaXin
** @ Description:客户端类
** @ Version:1.0.0
** @ ClassName:CClient
** @ Fun:
********************************************************************************/

#include <QObject>
#include <QMutex>
#include <QVector>
#include <QMap>
#include "ctagdata.h"

class CClientData: public QObject
{
	Q_OBJECT

public:
	CClientData();
	~CClientData();

    //清空
    void clearTags();
    //刷新测点总数
    int getPointCount();

public slots:
    void slotClientStatusChanged(QString sGuid, bool bState);

public:
    QMutex* m_pMutex;               //资源锁，外部访问的时候都应该加锁
    QString m_sGuid;                //IP:port
	//通信配置
	QString m_sIp;
	int m_nPort;
	QString m_sName;
    bool m_bEnabled;                //是否启用
	//客户端状态
    bool m_bState;                  //通信状态
    bool m_bAlarm;                  //报警状态
    double m_dCPU;                  //CPU占用率
    double m_dMemory;               //内存占用率
    double m_dDiskUsage;            //硬盘可用空间
    double m_dTemperature;          //设备温度
	//测点
    bool m_bTagsReadReady;          //测点是否可读写(用于防止修改测点时产生的冲突)
    int m_nPointCount;              //测点总数
    int m_nCRCType;                 //校验类型
    quint16 m_nCRC;                 //CRC校验码
    QMap<int, CTagData*>    m_mapTag;  //测点列表
    QVector<CTagData*>      m_vecTag;    //测点列表
};
#endif
